package cn.edu.nju.notification;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.widget.AnalogClock;

import cn.edu.nju.newsFeed.CommentItem;
import cn.edu.nju.newsFeed.NewsFeedItem;

public class AtNotification {
	private String summary;
	private NewsFeedItem newsFeedItem = null;
	private List<CommentItem> commentItems = null; // conversation between you and her sort by time
	private long id;
	
	Activity activity;
	
	public AtNotification(String summary,Activity activity,long id){
		this.summary = summary;
		this.activity = activity;
		this.id = id;
	}
	
	public String getSummary(){
		return summary;
	}
	
	public NewsFeedItem getNewsFeedItem(){
		if(newsFeedItem == null){
			refresh();
		}
		return newsFeedItem;
	}
	
	public List<CommentItem> getCommentItems(){
		if(commentItems == null){
			refresh();
		}
		return commentItems;
	}
	
	public void refresh(){
		if(newsFeedItem == null){
			newsFeedItem = new NewsFeedItem(0, 0, null, "NJUer", "NJU 110th, Software Institute 10th\nCongratulation!",
					null, null, 3, 5, 2,activity);
		}
		else{
			newsFeedItem.refreshExceptComments();
		}
		
		commentItems = new ArrayList<CommentItem>();
		for(int i = 0; i < 5; i++){
			commentItems.add(new CommentItem(0, 0, null, "YYer", "@NJUer I'm very happy about that",
					null, 5,activity));
		}
	}
	
	public void addReply(CommentItem item){
		commentItems.add(item);
		// update server
	}
}
